package com.nlscan.qdkit.common.core.util

import android.Manifest
import android.content.pm.PackageManager
import android.os.Build
import androidx.core.content.ContextCompat

/**
 * <pre>
 *  author: lin.qing
 *  time  : 2023/4/4
 *  desc  :
 * </pre>
 * -- 2023-04-04 AndroidUtilCode 作者已不再维护  将原有的 PermissionUtils 改为依赖 XxPermissions，
 * 废弃
 */
object PermissionExUtils {

    // TODO: 待适配targetSdk
    fun isGrantedBluetoothConnect(): Boolean {
        val isGeAndroid12 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
        return if (isGeAndroid12) {
            ContextCompat.checkSelfPermission(
                UtilEx.getContext(),
                Manifest.permission.BLUETOOTH_CONNECT
            ) == PackageManager.PERMISSION_GRANTED
        } else {
            true
        }
    }

}